Fix bug #150790:
authorMatthias Clasen <mclasen@redhat.com>
Fri, 1 Oct 2004 21:39:01 +0000 (21:39 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 1 Oct 2004 21:39:01 +0000 (21:39 +0000)
2004-10-01  Matthias Clasen  <mclasen@redhat.com>

Fix bug #150790:

* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): Fix the
calculation of x_offset when ellipsized and in RTL mode.
(gtk_cell_renderer_text_render): Fix the calculation of the layout
width when ellipsized.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcellrenderertext.c

index f101aa862dc2df3e3a1812a85cbc135d1800ce1f..6ccd9b475c5844c97a35aa69bc3eb62bd336342d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-10-01  Matthias Clasen  <mclasen@redhat.com>
+
+       Fix bug #150790:
+       
+       * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): Fix the
+       calculation of x_offset when ellipsized and in RTL mode.
+       (gtk_cell_renderer_text_render): Fix the calculation of the layout
+       width when ellipsized.  
+
 2004-10-01  Tor Lillqvist  <tml@iki.fi>
 
        * gdk/win32/gdkglobals-win32.c: Set _gdk_input_ignore_wintab to
index f101aa862dc2df3e3a1812a85cbc135d1800ce1f..6ccd9b475c5844c97a35aa69bc3eb62bd336342d 100644 (file)
@@ -1,3 +1,12 @@
+2004-10-01  Matthias Clasen  <mclasen@redhat.com>
+
+       Fix bug #150790:
+       
+       * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): Fix the
+       calculation of x_offset when ellipsized and in RTL mode.
+       (gtk_cell_renderer_text_render): Fix the calculation of the layout
+       width when ellipsized.  
+
 2004-10-01  Tor Lillqvist  <tml@iki.fi>
 
        * gdk/win32/gdkglobals-win32.c: Set _gdk_input_ignore_wintab to
index f101aa862dc2df3e3a1812a85cbc135d1800ce1f..6ccd9b475c5844c97a35aa69bc3eb62bd336342d 100644 (file)
@@ -1,3 +1,12 @@
+2004-10-01  Matthias Clasen  <mclasen@redhat.com>
+
+       Fix bug #150790:
+       
+       * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): Fix the
+       calculation of x_offset when ellipsized and in RTL mode.
+       (gtk_cell_renderer_text_render): Fix the calculation of the layout
+       width when ellipsized.  
+
 2004-10-01  Tor Lillqvist  <tml@iki.fi>
 
        * gdk/win32/gdkglobals-win32.c: Set _gdk_input_ignore_wintab to
index f101aa862dc2df3e3a1812a85cbc135d1800ce1f..6ccd9b475c5844c97a35aa69bc3eb62bd336342d 100644 (file)
@@ -1,3 +1,12 @@
+2004-10-01  Matthias Clasen  <mclasen@redhat.com>
+
+       Fix bug #150790:
+       
+       * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): Fix the
+       calculation of x_offset when ellipsized and in RTL mode.
+       (gtk_cell_renderer_text_render): Fix the calculation of the layout
+       width when ellipsized.  
+
 2004-10-01  Tor Lillqvist  <tml@iki.fi>
 
        * gdk/win32/gdkglobals-win32.c: Set _gdk_input_ignore_wintab to
index dfb770d57ad9df692fca110181f9f258e2e1f03a..ec7aaa33c30ef584a3e1ceea0df7364c222655f4 100644 (file)
@@ -1412,11 +1412,13 @@ gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
     {
       if (x_offset)
        {
-         *x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
-                      (1.0 - cell->xalign) : cell->xalign) * (cell_area->width - rect.width - (2 * cell->xpad));
          if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
-           *x_offset -= rect.width;
-         *x_offset = MAX (*x_offset, 0);
+           *x_offset = (1.0 - cell->xalign) * (cell_area->width - rect.width - (2 * cell->xpad));
+         else 
+           *x_offset = cell->xalign * (cell_area->width - rect.width - (2 * cell->xpad));
+
+         if (priv->ellipsize)
+           *x_offset = MAX(*x_offset, 0);
        }
       if (y_offset)
        {
@@ -1503,7 +1505,8 @@ gtk_cell_renderer_text_render (GtkCellRenderer      *cell,
     }
 
   if (priv->ellipsize)
-    pango_layout_set_width (layout, cell_area->width * PANGO_SCALE);
+    pango_layout_set_width (layout, 
+                           (cell_area->width - x_offset - 2 * cell->xpad) * PANGO_SCALE);
   else
     pango_layout_set_width (layout, -1);